import request from '@/utils/request'

// 查询商品关系列表
export function listProdRel(query) {
  return request({
    url: '/business/prodRel/list',
    method: 'get',
    params: query
  })
}

// 查询商品关系详细
export function getProdRel(id) {
  return request({
    url: '/business/prodRel/' + id,
    method: 'get'
  })
}

// 新增商品关系
export function addProdRel(data) {
  return request({
    url: '/business/prodRel',
    method: 'post',
    data: data
  })
}

// 修改商品关系
export function updateProdRel(data) {
  return request({
    url: '/business/prodRel',
    method: 'put',
    data: data
  })
}

// 删除商品关系
export function delProdRel(id) {
  return request({
    url: '/business/prodRel/' + id,
    method: 'delete'
  })
}

// 状态变更
export function updateChangeStatus(data){
  return request({
    url: '/business/prodRel/changeStatus',
    method: 'put',
    params: data
  })
}

// 根据商品编码查询明细
export function getProdDetailsByMainId(mainId) {
  return request({
    url: '/business/prodDetails/getProdDetailsByMainId/' + mainId,
    method: 'get',
  })
}

// 刷新缓存
export function refreshCache() {
  return request({
    url: '/business/prodRel/refreshCache',
    method: 'delete'
  })
}
